#!/usr/bin/env python
#-*- coding:UTF-8 -*-
import rospy
from std_msgs.msg import UInt8
import gpio_ctrl as io
import Jetson.GPIO as GPIO
import time

beep_ch=31

def gpio_beep_ctrl(channel):
    # 输出脉冲信号模拟pwm，用于控制舵机
    # channel为针脚标号，已测试11可用

    GPIO.setmode(GPIO.BOARD)        # 设置Jetson nano板正面对应针脚标号
    GPIO.setup(channel, GPIO.OUT)   # 设置输出通道

    GPIO.output(channel, GPIO.HIGH)
    time.sleep(1)
    GPIO.output(channel, GPIO.LOW)


channel=7

GPIO.setmode(GPIO.BOARD)
#GPIO.setup(channel, GPIO.OUT)
#GPIO.output(channel, GPIO.HIGH)
GPIO.setup(channel, GPIO.IN)

GPIO.wait_for_edge(channel, GPIO.BOTH)
gpio_beep_ctrl(beep_ch)

GPIO.cleanup()

